#!/bin/bash 

source ./test.cfg

DEBUG=0

if [ -z $1 ]; then
  NODE=msserver01a
  ID=c00000001
  APPID=a01
else
  NODE=${APPLIANCE[$1]}
  ID=${CAR[$1]}
  APPID=${APP[$1]}
fi
# TOPIC=/APP/${APPID}/CAR/${ID}


ENDPOINT=`/niagara/test/scripts/getclusterserverendpointport.py -c ${CLUSTER} -e SVT-CarsInternetEndpoint -a ${NODE}`
SERVER=${ENDPOINT/:*/}
PORT=${ENDPOINT/*:/}


if [ ${DEBUG} -ne 0 ]; then
  echo CLUSTER=${CLUSTER}
  echo NODE=${NODE}
  echo ENDPOINT=${ENDPOINT}
  echo QOS=${QOS}
  echo MESSAGES=${MESSAGES}
  echo ID=${ID}
fi



echo java -Xss128K -Xzero -Xms128M -Xmx128M -Xshareclasses -Djavax.net.debug=false -Djavax.net.ssl.trustStore=${CACERTS} -Djavax.net.ssl.trustStorePassword=${PASSWORD} svt.scale.vehicle.SVTVehicle -server "${SERVER}" -userName ${ID} -password "svtpvtpass" -port ${PORT} -qos ${QOS} -paho ${CARS} -messages ${MESSAGES} -vverbose ${VERBOSE} -listener false -iotf ${IOTF} -ssl ${SSL} -cleanSession false -rate 60 -verbose_connect ${VERBOsE_CONNECT} -genClientID false -verbose_connectionLost true -reconnectDelay 60000  -keepAlive 900 -connectionTimeout 600 -connectionThrottle 5 -order ${ORDER} -appid ${APPID}
java -Xss128K -Xzero -Xms128M -Xmx128M -Xshareclasses -Djavax.net.debug=false -Djavax.net.ssl.trustStore=${CACERTS} -Djavax.net.ssl.trustStorePassword=${PASSWORD} svt.scale.vehicle.SVTVehicle -server "${SERVER}" -userName ${ID} -password "svtpvtpass" -port ${PORT} -qos ${QOS} -paho ${CARS} -messages ${MESSAGES} -vverbose ${VERBOSE} -listener false -iotf ${IOTF} -ssl ${SSL} -cleanSession false -rate 60 -verbose_connect ${VERBOsE_CONNECT} -genClientID false -verbose_connectionLost true -reconnectDelay 60000  -keepAlive 900 -connectionTimeout 600 -connectionThrottle 5 -order ${ORDER} -appid ${APPID}

